/**
 * 容缺补正操作的api  js
 */
import request from "@/utils/request";

const baseURL = process.env.VUE_APP_BASE_API;

/**
 * 分页查询容缺补正数据
 * @param {*} params
 */
export function queryPages(params) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH + "/zcbl/caseAvailability/queryPages",
    method: "get",
    params: params
  });
}

/**
 * 根据caseOid查询需要容缺后补的材料
 * @param {*} caseOid
 */
export function queryMaterialsByCaseOidAndAvailability(caseOid) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseAvailability/queryMaterialsByCaseOidAndAvailability/${caseOid}`,
    method: "POST",
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    }
  });
}

/**
 * 返回补齐补正材料上传的地址
 */
export function uploadFile() {
  return (
    baseURL +
    process.env.VUE_APP_KSTB_ROUTE_PATH +
    "/case/caseAtta/uploadFileAndSaveTbCaseAtta"
  );
}

/**
 * 文件上传到附件表
 * @param {*} data
 */
export function uploadFileByFile(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/case/caseAtta/uploadFileAndSaveTbCaseAtta",
    method: "post",
    /*
    headers: {
      "Content-Type": " multipart/form-data"
    },
   */

    data: data
  });
}

/**
 * 保存容缺补正数据
 * @param {*} data
 */
export function saveCaseAvailability(data) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      "/zcbl/caseAvailability/saveCaseAvailability",
    method: "post",
    headers: {
      "Content-Type": "application/json"
    },
    data: data
  });
}

/**
 * 根据caseOid终止办件
 * @param {*} caseOid
 */
export function stopCaseAvailability(caseOid, stopCause) {
  return request({
    url:
      process.env.VUE_APP_KSTB_ROUTE_PATH +
      `/zcbl/caseAvailability/stopCaseAvailability`,
    method: "get",
    params: {
      caseOid: caseOid,
      stopCause: stopCause
    }
  });
}
